import LevelData from "./LevelData";

const {ccclass, property} = cc._decorator;

//配置管理
@ccclass
export default class ConfigManager extends cc.Component {
    @property(cc.JsonAsset)
    levelJson:cc.JsonAsset = null
    static instance:ConfigManager = null
    levels:LevelData[] = []
    onLoad(){
        ConfigManager.instance = this
        this.loadLevelConfig()
    }

    // 加载关卡的配置文件
    loadLevelConfig(){
        // 得到json对象
        const json = this.levelJson.json
        json.forEach(obj => {//遍历json文件的数组
            let levelData = new LevelData(obj)
            this.levels.push(levelData)
            console.log(levelData)
        });
        
    }
}
